Skip to content

fix(lint): allow defaulted loop counters - #16667

Merged
figtracer merged 1 commit into
masterfrom
fig/lint-loop-counters
Sep 5, 2026
Merged

fix(lint): allow defaulted loop counters#16667
figtracer merged 1 commit into
masterfrom
fig/lint-loop-counters

Conversation

@figtracer

Copy link
Copy Markdown
Member

Recognize the intentional zero start in for (uint256 i; i < n; ++i) instead of reporting its counter as an uninitialized read. The exception is limited to unsigned counters declared in the header, compared against an upper bound, and incremented with ++; declarations outside the header and other uninitialized locals still warn. Loop-body findings and zero-iteration write handling remain unchanged.

Fixes #16641.

Recognize unsigned for-header counters with upper-bound conditions and increment updates, without suppressing other uninitialized reads or changing loop state restoration.
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

✅ Changelog found

The deterministic check will validate the changed entry.

@mattsse mattsse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@figtracer
figtracer merged commit 78bf720 into master Sep 5, 2026
32 checks passed
@figtracer
figtracer deleted the fig/lint-loop-counters branch September 5, 2026 10:59
@github-project-automation github-project-automation Bot moved this to Done in Foundry Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(lint): uninitialized-local false-positives on a for-loop's own init counter

3 participants